package com.hengxinguotong.zhihuichengjian.ui.tower.violation;

import com.hengxinguotong.zhihuichengjian.R;
import com.hengxinguotong.zhihuichengjian.bean.TowerViolation;
import com.hengxinguotong.zhihuichengjian.ui.BaseActivity;
import com.hengxinguotong.zhihuichengjian.utils.SPUtil;
import com.hengxinguotong.zhihuichengjian.widget.font.HXTextView;

import android.os.Bundle;
import android.view.View;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * @CopyRight 恒信国通信息科技
 * @Author WuLei
 * @Date 2019/2/24
 *
 * 塔吊违章详情
 */

public class TowerViolationDetailActivity extends BaseActivity implements View.OnClickListener {
    @BindView(R.id.title_tv)
    HXTextView titleTv;
    @BindView(R.id.upload_time)
    HXTextView uploadTime;
    @BindView(R.id.province)
    HXTextView province;
    @BindView(R.id.equipment_name)
    HXTextView equipmentName;
    @BindView(R.id.equipment_number)
    HXTextView equipmentNumber;
    @BindView(R.id.lift_time)
    HXTextView liftTime;
    @BindView(R.id.lift_height)
    HXTextView liftHeight;
    @BindView(R.id.lift_extent)
    HXTextView liftExtent;
    @BindView(R.id.lift_angle)
    HXTextView liftAngle;
    @BindView(R.id.unlift_time)
    HXTextView unliftTime;
    @BindView(R.id.unlift_height)
    HXTextView unliftHeight;
    @BindView(R.id.unlift_extent)
    HXTextView unliftExtent;
    @BindView(R.id.unlift_angle)
    HXTextView unliftAngle;
    @BindView(R.id.max_weight)
    HXTextView maxWeight;
    @BindView(R.id.max_load)
    HXTextView maxLoad;
    @BindView(R.id.is_illegal)
    HXTextView isIllegal;

    private TowerViolation towerViolation;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tower_violation_detail);
        ButterKnife.bind(this);
        towerViolation = (TowerViolation) getIntent().getSerializableExtra("towerViolation");
        initView();
    }

    private void initView() {
        titleTv.setText(R.string.tower_violation_detail);

        uploadTime.setText(towerViolation.getAcquisitionTime());
        province.setText(towerViolation.getProvince() + towerViolation.getCity() + towerViolation.getArea());
        equipmentName.setText(towerViolation.getEquipmentName());
        equipmentNumber.setText(towerViolation.getNumber());

        liftTime.setText(towerViolation.getLiftTime());
        liftHeight.setText(towerViolation.getLiftHeight() + "米");
        liftExtent.setText(towerViolation.getLiftExtent() + "米");
        liftAngle.setText(towerViolation.getLiftAngle() + "度");

        unliftTime.setText(towerViolation.getUnLiftTime());
        unliftHeight.setText(towerViolation.getUnLiftHeight() + "米");
        unliftExtent.setText(towerViolation.getUnLiftExtent() + "米");
        unliftAngle.setText(towerViolation.getUnLiftAngle() + "度");

        maxWeight.setText(towerViolation.getMaxWeight() + "千克");
        maxLoad.setText(towerViolation.getMaxFh() + "%");
        if(towerViolation.getIsIllegal() == 1){
            isIllegal.setTextColor(getResources().getColor(R.color.color_D0021B));
        }else {
            isIllegal.setTextColor(getResources().getColor(R.color.color_999999));
        }
        isIllegal.setText(towerViolation.getIsIllegalStr());
    }

    @OnClick({R.id.back_tv})
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.back_tv:
                finish();
                break;
        }
    }
}
